package cmd

import (
	"github.com/spf13/cobra"
	"mongofix/conf"
)

var rootCmd = &cobra.Command{
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		//初始化配置信息和数据库
		conf.InitConfig()
		conf.InitDB()
	},
}

func Execute() error {
	return rootCmd.Execute()
}
func init() {
	rootCmd.PersistentFlags().StringVarP(&conf.Env, "env", "e", conf.TEST, "系统运行环境")
}
